<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>类方式组件</title>
    <script src="https://cdn.staticfile.org/react/16.4.0/umd/react.development.js"></script>
    <script src="https://cdn.staticfile.org/react-dom/16.4.0/umd/react-dom.development.js"></script>
    <script src="https://cdn.staticfile.org/babel-standalone/6.26.0/babel.min.js"></script>
</head>

<body>
    <div id="root"></div>
    <div id="root2"></div>
    <script type="text/babel">
        // 类方式制作组建：创建强大能力组建， 必须继承父类
        class HelloWorld extends React.Component {
            // 固定方法, 语法糖转化时，固定调用 render()方法
            render() {
                return <h1>你好家驴</h1>
            }
        }

        // 基本
        ReactDOM.render(new HelloWorld().render(), root)

        // 语法糖简化
        ReactDOM.render(<HelloWorld />, root)

        // 复用
        let more = (
            <div>
                <HelloWorld />
                <HelloWorld />
                <HelloWorld />
                <HelloWorld />
                <HelloWorld /></div>
        )

        ReactDOM.render(more, root2)

    </script>
</body>

</html>